10998 REM *********** READ DATA FROM DISK ***********
10999 REM
11000 HOME : IF (DR <3) THEN GOSUB 20000
11001 IF (DR >2) THEN GOSUB 22000
11002 IF Z$ = CHR$(27) THEN GOTO 32000
11003 IF Z$ = CHR$(27) THEN GOTO 32000
11004 IF (DR <3) AND (CODE$ = "ERROR") THEN GOTO 11000
11005 IF (DR >2) AND (CODE$ = "ERROR") THEN GOTO 11000
11009 IF NP% < >1 THEN GOTO 11065
11010 HOME : VTAB 10: HTAB 8: PRINT "YOUR DATA HAS BEEN ALTERED ": HTAB 8: PRINT "SINCE YOU SAVED TO DISK ": PRINT : HTAB 8: PRINT "DO YOU WISH TO SAVE YOUR": HTAB 8: PRINT "PRESENT DATA TO DISK ? ";: GET Z$
11020 IF Z$ = "Y" OR Z$ = "y" THEN GOTO 15000
11065 GOSUB 2020
11070 IF W$(1) = "" THEN HOME : VTAB 10: PRINT "THERE ARE NO TEXT FILES ": PRINT "ON THIS DISK": FOR J = 1 TO 1600: NEXT : GOTO 11140
11080 WA$ = W$(CV)
11085 W2$ = HP$ +W$(CV)
11090 PRINT D$;"OPEN";W2$
11100 PRINT D$;"READ";W2$
11110 INPUT NP
11120 FOR J = 1 TO NP: CALL 39169,A$(J): CALL 39169,SA$(J): CALL 39169,B$(J): CALL 39169,SB$(J): CALL 39169,C$(J): CALL 39169,CC$(J): CALL 39169,E$(J): NEXT
11130 PRINT D$;"CLOSE";W2$
11140 NP% = 0
11150 HOME
11160 IF MA >47 THEN PRINT D$;"PREFIX /RAM/": GOTO 32000
11170 PRINT D$;"PREFIX ";PR$: GOTO 32000
12000 PRINT CHR$(4);"CHAIN ADD.ENTER,@12000"
14997 REM
14998 REM *********** SAVE DATA ON DISK *************
14999 REM
15000 HOME : GOSUB 20000: IF CODE$ = "ERROR" THEN GOTO 15000
15002 IF Z$ = CHR$(27) THEN GOTO 32000
15003 HOME : PRINT : IF WA$ = "" THEN GOTO 15040
15005 VTAB 1: HTAB 1: PRINT "ESC TO QUIT"
15010 VTAB 10: PRINT "CURRENT FILE : ";WA$
15020 VTAB 12: PRINT "SAVE UNDER CURRENT FILE NAME ? ";: GET Z$: PRINT Z$;
15025 IF Z$ = CHR$(27) THEN GOTO 15220
15030 IF Z$ = "Y" OR Z$ = "y" THEN GOTO 15130
15035 HOME
15040 VTAB 12: PRINT "DATA FILE NAME: ": VTAB 2: PRINT "ENTER C FOR A CATALOG": VTAB 3: PRINT "ENTER Q TO QUIT"
15050 VTAB 12: HTAB 19: INPUT "";Z$
15060 IF Z$ = "Q" GOTO 15220
15070 IF Z$ = "q" GOTO 15220
15080 IF Z$ = "C" GOTO 15110
15090 IF Z$ = "c" GOTO 15110
15091 IF LEN(Z$) <2 THEN PRINT : PRINT : PRINT : PRINT "LENGTH OF NAME MUST BE GREATER THAN 1";: CALL 64668: GOTO 15050
15092 IF ASC(Z$) >90 AND ASC(Z$) <97 THEN GOTO 15096
15093 IF ASC(Z$) <65 OR ASC(Z$) >122 THEN GOTO 15096
15094 GOTO 15100
15096 PRINT : PRINT : PRINT : PRINT "FILE NAME MUST BEGIN WITH A LETTER ";: CALL 64668: PRINT
15097 PRINT : PRINT "PLEASE DO NOT USE CHARACTERS OTHER THAN";: CALL 64668: PRINT : PRINT :: PRINT "LETTERS,NUMBERS OR PERIODS";: CALL 64668: GOTO 15050
15100 WA$ = Z$: GOTO 15130
15110 GOSUB 2006: HOME : PRINT CHR$(4);"CAT ";HP$
15120 PRINT "PRESS A KEY TO CONTINUE";: GET Z$: GOTO 15035
15130 GOSUB 2006:W2$ = HP$ +WA$
15135 HOME : VTAB 10: PRINT " SAVING ";W2$
15140 D$ = CHR$(4)
15150 IF A$(0) = "" AND B$(0) = "" AND A$(1) = "" AND B$(1) = "" THEN VTAB 10: PRINT " NO DATA IS IN MEMORY ";: GET Z$: GOTO 32000
15160 PRINT D$;"OPEN";W2$
15170 PRINT D$;"WRITE";W2$
15180 PRINT NP
15190 FOR J = 1 TO NP: PRINT A$(J): PRINT SA$(J): PRINT B$(J): PRINT SB$(J): PRINT C$(J): PRINT CC$(J): PRINT E$(J): NEXT
15200 PRINT D$;"CLOSE";W2$
15210 NP% = 0
15220 HOME
15230 IF MA >47 THEN PRINT D$;"PREFIX /RAM/": GOTO 32000
15240 PRINT D$;"PREFIX ";PR$: GOTO 32000
20000 CODE$ = ""
20010 IF DR = 1 THEN BT = 16 *SL
20020 IF DR = 2 THEN BT = (16 *SL) +128
20030 POKE 867,BT
20040 CALL 870
20050 PK = PEEK(850)
20060 ER = (PK/16 - INT(PK/16)) *16
20070 IF ER = 0 THEN VTAB 10: HTAB 4: PRINT "I/O ERROR, PLEASE CHECK DRIVE. ";:CODE$ = "ERROR ": GET Z$: RETURN
20080 FOR I = 851 TO 865
20090 CODE$ = CODE$ + CHR$( PEEK(I))
20100 NEXT I
20110 RETURN
21010 CODE$ = ""
21020 IF DI = 1 THEN BT = 16 *SI
21030 IF DI = 2 THEN BT = (16 *SI) +128
21040 POKE 867,BT
21050 CALL 870
21060 PK = PEEK(850)
21070 ER = (PK/16 - INT(PK/16)) *16
21080 IF ER = 0 THEN CODE$ = "ERROR": RETURN
21090 FOR I = 851 TO 865
21100 CODE$ = CODE$ + CHR$( PEEK(I))
21110 NEXT I
21120 RETURN
22000 FOR DI = 1 TO 2
22010 FOR SI = 7 TO 1 STEP -1
22020 GOSUB 21010
22022 HP$ = ""
22023 FOR J = 2 TO LEN(PD$)
22024 IF MID$ (PD$,J,1) = "/" THEN J = LEN(PD$): GOTO 22035
22025 HP$ = HP$ + MID$ (PD$,J,1)
22035 NEXT J
22037 IF MID$ (CODE$,1, LEN(HP$)) = HP$ THEN RETURN
22040 NEXT SI
22050 NEXT DI
22060 CODE$ = "ERROR"
22065 VTAB 1: PRINT "PRESS ESC TO GO BACK"
22070 VTAB 10: HTAB 7: PRINT "PLEASE INSERT DATA DISK ": VTAB 12: HTAB 7: PRINT "PRESS A KEY TO CONTINUE ";: GET Z$